//
//  MainWindowsHelper.java
//  ics314-calendar
//
//  Created by ICS314 Team Mississippi  on 7/30/14.
//  Copyright (c) 2014 JinHao Chen, Christian Caluya,Kevin Fujikawa. All rights reserved.
//
import javax.swing.JCheckBox;
import javax.swing.JFrame;

public class MainWindowsHelper {
	
	/**
	 * Dynamic Create Exception Date when the user choose recurring event
	 * @param  s  the current selection
	 * @param  chckbxDay[]  the checkBox for the recurring event select
	 * @param  frame  the current JFrame
	 * @return  void
	 */
	public static void dynamicCreateExceptionDate(String s, JCheckBox chckbxDay[],JFrame frame){
		//Case Weekly
		if (s.equals("Every Week")) {
			for (int i = 0; i < 12 ; i++ ){
				switch (i) {
					case 0 :
						chckbxDay[i].setText("Mon");
						break;
					case 1 :
						chckbxDay[i].setText("Tue");
						break;
					case 2 :
						chckbxDay[i].setText("Wed");
						break;
					case 3 :
						chckbxDay[i].setText("Thu");
						break;
					case 4 :
						chckbxDay[i].setText("Fri");
						break;
					case 5:
						chckbxDay[i].setText("Sat");
						break;
					case 6 :
						chckbxDay[i].setText("Sun");
						break;
					default:
						chckbxDay[i].setText("N/A");
						break;
				}		
				if (i>=7) {
					chckbxDay[i].setEnabled(false);
					continue;
				} else {	
					chckbxDay[i].setSelected(true);
					chckbxDay[i].setEnabled(true);
				}
			}
	    }
		//Case Monthly
	    	if (s.equals("Every Year")) {
			for (int i = 0; i < 12 ; i++ ){
				switch (i) {
					case 0 :
						chckbxDay[i].setText("Jan");
						break;
					case 1 :
						chckbxDay[i].setText("Feb");
						break;
					case 2 :
						chckbxDay[i].setText("Mar");
						break;
					case 3 :
						chckbxDay[i].setText("Apr");
						break;
					case 4 :
						chckbxDay[i].setText("May");
						break;
					case 5:
						chckbxDay[i].setText("Jun");
						break;
					case 6 :
						chckbxDay[i].setText("Jul");
						break;
					case 7 :
						chckbxDay[i].setText("Aug");
						break;
					case 8 :
						chckbxDay[i].setText("Sep");
						break;
					case 9 :
						chckbxDay[i].setText("Oct");
						break;
					case 10 :
						chckbxDay[i].setText("Nov");
						break;
					case 11 :
						chckbxDay[i].setText("Dec");
						break;
					default:
						chckbxDay[i].setText("Null");
						break;
				}	
				chckbxDay[i].setSelected(true);
				chckbxDay[i].setEnabled(true);
			}
		}
		//Case "None" && Daily && Yearly
	    	if (s.equals("None") || s.equals("Every Day") || s.equals("Every Month")) {
	    		for (int i = 0 ; i < 12 ; i++) {	
	    			chckbxDay[i].setSelected(false);
				chckbxDay[i].setText("N/A");	
		    		chckbxDay[i].setEnabled(false);	
	    		}
	    }
	    	
	}
}

